import { Suspense } from "react";
import { Skeleton } from "@/components/ui/skeleton";
import { Card, CardContent, CardHeader } from "@/components/ui/card";
import DolceUploadPageV2 from "./dolce-upload-page-v2";
import { Shell } from "@/components/shell";
import { useTranslation } from "@/i18n"

// ============================================================================
// 로딩 스켈레톤
// ============================================================================

function DolceUploadSkeleton() {
  return (
    <div className="space-y-4">
      <Card>
        <CardHeader>
          <Skeleton className="h-8 w-48" />
        </CardHeader>
        <CardContent>
          <Skeleton className="h-32 w-full" />
        </CardContent>
      </Card>
      <Card>
        <CardHeader>
          <Skeleton className="h-8 w-48" />
        </CardHeader>
        <CardContent>
          <Skeleton className="h-96 w-full" />
        </CardContent>
      </Card>
    </div>
  );
}

export default async function DolceUploadPageWrapper({
  params,
  searchParams,
}: {
  params: Promise<{ lng: string }>;
  searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
}) {
  const { lng } = await params;
  const { t } = await useTranslation(lng, 'menu')
  const resolvedParams = await searchParams;
  
  return (
    <Shell variant="fullscreen">
      {/* 헤더 */}
      <div className="flex items-center justify-between flex-shrink-0">
        <div>
          <h2 className="text-2xl font-bold tracking-tight">
            {t('menu.vendor.engineering.document_list_ship')}
          </h2>
        </div>
      </div>

      {/* 메인 컨텐츠 */}
      <Suspense fallback={<DolceUploadSkeleton />}>
        <DolceUploadPageV2 searchParams={resolvedParams} />
      </Suspense>
    </Shell>
  );
}

